import { addCustomBlocks } from "../Blocks/HomePage/addCustomBlocks";
import { addCaseCard } from "../Blocks/HomePage/addCaseCard";
import { addNavBar } from "../Blocks/HomePage/addNavBar";
import { addColumn } from "../Blocks/HomePage/addColumn";
import { addCarousel } from "../Blocks/HomePage/addCarousel";
import { addLastIntroduce } from '../Blocks/HomePage/addLastIntroduce';
import { addArticleCategoryManager } from "../Blocks/Column/addArticleCategoryManager";
export const HomePageBlockManager = (editor) => {
  // ------------------------------------------------------------------------------------------------------------
  /*
    添加自定义块Baseblock组件
  */
  addCustomBlocks(editor);

  // ------------------------------------------------------------------------------------------------------------
  /*
    添加案例卡片组件
  */
  addCaseCard(editor);
  editor.BlockManager.add("CaseCard", {
    label: "案例卡片",
    category: "首页组件",
    select: true,
    content: { type: "CaseCard" },
  });

  // ------------------------------------------------------------------------------------------------------------
  /*
    注册顶部导航栏组件
  */
  const opts = {
    id: "navbar",
    label: "Navbar",
    classPrefix: "navbar",
    style: "",
    styleAdditional: "",
  };
  addNavBar(editor, opts);
  editor.BlockManager.add("navbar", {
    // 分类的展示图标
    media: `<svg viewBox="0 0 24 24">
            <path d="M22 9c0-.6-.5-1-1.25-1H3.25C2.5 8 2 8.4 2 9v6c0 .6.5 1 1.25 1h17.5c.75 0 1.25-.4 1.25-1V9Zm-1 6H3V9h18v6Z"/><path d="M15 10h5v1h-5zM15 13h5v1h-5zM15 11.5h5v1h-5z"/>
        </svg>`,
    label: "顶部导航",
    category: "首页组件",
    select: true,
    content: { type: "navbar" },
  });

  // ------------------------------------------------------------------------------------------------------------
  /*
    栏目组件
  */
  const opt = {
    ColumnBlock: { category: "首页组件", label: "栏目组件" }, // 用来扩展默认的flexbox块
    stylePrefix: "gjs-", // Class类的前缀
    labelRow: "Row", // 行标签
    labelColumn: "Column", // 列标签
  };
  addColumn(editor, opt);

  // -------------------------------------------------------------------------------------------------------------
  /*
    官网页尾介绍组件
  */
  addLastIntroduce(editor);


};
